//
//  IMSecurity.h
//  IMSecurity
//
//  Created by infosec2013 on 16/6/23.
//  Copyright © 2016年 IF. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "IMError.h"
#import "IMToken.h"
#import "IMCert.h"
#import "IMUser.h"
#import "IMClientHttp.h"
#import "IMClientSocket.h"
#import "IMPDFSignature.h"
#import "IMApp.h"
#import "IMAuthInfo.h"
#import "IMMessage.h"
#import "IMOSLoginLog.h"
#import "IMOSLoginLauncher.h"
#import "IMPCInfo.h"

//! Project version number for IMSecurity.
FOUNDATION_EXPORT double IMSecurityVersionNumber;

//! Project version string for IMSecurity.
FOUNDATION_EXPORT const unsigned char IMSecurityVersionString[];


typedef NSDictionary *(^IMNetworkBlock)(NSDictionary *dictPrams);

int infosec_initialize_default(char host[128],int service_port,NSArray *serverCerts);

int infosec_initialize_with_otp(char host[128],int service_port,NSArray *serverCerts,unsigned char *otpSeed, int otpSeedLen);

int infosec_initialize_with_key(char host[128],int service_port,NSArray *serverCerts,unsigned char *appid,int appidLen,unsigned char *appSecKey, int appSecKeyLen);

int infosec_finalize();

@interface IMSecurity : NSObject

+ (instancetype)shareSecurity;

/**
 获取系统App版本号

 @param completeBlock 完成后执行block 
        resultCode:返回码 0:成功 其他:失败
        curVersion:当前最新版本
        updateURL:更新路径
 */
- (void)getSysAppVersionWithCompleteBlock:(void(^)(int resultCode,NSString *curVersion,NSString *updateURL))completeBlock;

/**
 获取SDK版本

 @return 版本信息
 */
+ (NSString *)getVersion;

/**
 *  获取唯一标识
 *
 *  @return 设备唯一标识字符串
 */
+ (NSString *)getDeviceIdentifier;

/**
 Base64编码

 @param data 原文数据
 @return 编码后的字符串
 */
+(NSString *)base64EncodingWithPlainData:(NSData *)data;

/**
 base64解码

 @param base64String 待解码base64字符串
 @return 解码后的字节流数据
 */
+(NSData *)base64DecodingWithBase64String:(NSString *)base64String;

/// 是否支持PDF签章
+ (BOOL)isSupportPDFSignature;

/// 是否支持证书
+ (BOOL)isSupportCert;

/// 是否支持令牌
+ (BOOL)isSupportToken;

+ (BOOL)isForceUpdate;

+ (BOOL)isSupportRegistBySelf;

/// 设置网络请求block
/// @param block 网络请求block，只有在离线调用时需要设置,dictParams中参数url params分别对应服务接口和完整参数。返回服务器响应数据
+ (void)settingNetworkBlock:(IMNetworkBlock)block;

@end
